<?php

class NCore_ABPipe extends NCore_Pipe
{
    function __construct($name)
    {
        parent::__construct($name);
    }
    public function setupViews()
    {
        $this->addView('feedback');
        $this->addView('error');
        $this->addView('a');
        $this->addView('b');
        $this->addView('empty');
        $this->addView('blank');
    }
	public function withMarkup($markup)
	{
        throw new Exception('To set the default markup on an ABPipe, call the method withAMarkup() and withBMarkup().');
	}
	public function withAMarkup($markup)
	{
		$this->getView('a')->withMarkup($markup);
		return $this;
	}
	public function withBMarkup($markup)
	{
		$this->getView('b')->withMarkup($markup);
		return $this;
	}
    public function withABView()
    {
        if(rand(1,2) < 2)
        {
            return $this->withSelectedView('a');
        }
        else
        {
            return $this->withSelectedView('b');
        }
    }
}

?>
